/*
 *  BlipUpInitApplication.cpp
 *  BlipUp
 *
 *  Created by Pete Bunting on 11/01/2012.
 *  Copyright 2012 Pete Bunting.
 * 
 *  BlipUp is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  BlipUp is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with BlipUp.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "BlipUpInitApplication.h"

namespace blipup
{
	BlipUpInitApplication::BlipUpInitApplication(int argc, char *argv[], BlipUpImageLoader *imgLoader) : QApplication(argc, argv)
	{
        this->imgLoader = imgLoader;
	}
	
	bool BlipUpInitApplication::event(QEvent *event)
	{
		QString file2Open = "";
		switch (event->type()) 
		{
			case QEvent::FileOpen:
				file2Open = static_cast<QFileOpenEvent *>(event)->file();
                imgLoader->loadImage(file2Open);
				return true;
			default:
				return QApplication::event(event);
        }
	}
}